﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;

namespace treadmillProject.src.model {
    [Serializable()]
    public class Gear : ISerializable {
        public Gear(int gearData) {
            GearData = gearData;
            if (gearData > MaxGear) {
                MaxGear = gearData;
            }
            Console.WriteLine("Gear init...");
        }

        public Gear(SerializationInfo info, StreamingContext ctxt) {
            GearData = (int) info.GetValue("Gear", typeof (int));
        }

        public int GearData { get; set; }
        public static int MaxGear { get; set; }

        public void GetObjectData(SerializationInfo info, StreamingContext ctxt) {
            info.AddValue("Gear", GearData);
        }
    }
}